<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="utf-8" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>上传页面</title>
<meta http-equiv="x-ua-compatible" content="ie=7" />
	<link href="<%=basePath%>style/txlz7.css" rel="stylesheet" type="text/css" id="txlz7"/>
	 <style>
			 td {
				font:12px/170% "宋体", "新宋体", "黑体"; color:#000
			}
			th {
				font:12px/170% "宋体", "新宋体", "黑体"; color:#000
			}
		.black_overlays{
			display: none;
			position: absolute;
			top: 0%;
			left: 0%;
			width: 100%;
			height: 100%;
			background-color: #C1EBFC;
			z-index:1002;
			-moz-opacity: 0.8;
			opacity:.80;
			filter: alpha(opacity=30);
		}
		
		.ErrorDiv {
			display: none;
			position: absolute;
			border: 1px solid #FFF;
			border-bottom:none;
			z-index:1003;
			overflow: auto;
		}
		.GroupDiv {
			display: none;
			position: absolute;
			border: 1px solid #FFF;
			border-bottom:none;
			z-index:1003;
			overflow: auto;
		}
		.tree {
	display: none;
	position: absolute;
	top: 25%;
	left: 30%;
	width: 253px;
	height: 235px;
	border: 1px solid #11557B;
	border-bottom: block;
	background-color: #E2F7FF;
	z-index: 1003;
	overflow: auto;
}
.title {
	display: none;
	position: absolute;
	top: 21%;
	left: 30%;
	width: 255px;
	height: 205px;
	border: 0px solid #000;
	border-bottom: none;
	background-color: #E2F7FF;
	z-index: 1003;
	overflow: auto;
}

  .prog-border {
  height: 15px;
  width: 205px;
  background: #fff;
  border: 1px solid #000;
  margin: 0;
  padding: 0;
  }

  .prog-bar {
  height: 11px;
  margin: 2px;
  padding: 0px;
  background: #178399;
  font-size: 10pt;
  }
  
  .lan01{
background: url(<%=basePath%>images/lanbg01.gif) no-repeat 0 0; width:6px; height:24px;} 
.lan02{
background: url(<%=basePath%>images/lanbg02.gif) repeat-x; width:99%; height:24px;}            
.lan03{
background: url(<%=basePath%>images/lanbg03.gif) no-repeat; width:8px; height:24px;}             
.cha{
padding-top:3px}
	 </style><link rel="stylesheet" type="text/css" href="<%=basePath%>ajaxFramework/ext-2.1/resources/css/ext-all.css" />
	<script type="text/javascript" src="<%=basePath%>ajaxFramework/ext-2.1/adapter/ext/ext-base.js"></script>
  	<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/ext-all.js"></script>
	<script type="text/javascript" src="<%=basePath %>ajaxFramework/ext-2.1/source/locale/ext-lang-zh_CN.js"></script> 
	<script type="text/javascript" src="<%=basePath %>ajaxFramework/jQuery/jquery.js"></script>
	<script type="text/javascript" src="<%=basePath %>js/common/fileUpload/ajaxfileupload.js"></script>
	<script type="text/javascript" src="<%=basePath %>fileDocument/fileUpload/ajaxFileZx.js"></script>
	
	<script>
	function submitform1(){
		document.form1.submit();
	}
	function sub(){
		var aa = document.getElementById("files").getElementsByTagName("input");
		var num = 0;
		for(var i=0;i<aa.length;i++){
			if(aa.type="hidden"){
				num++;
			}
		}
	}
	function fuzhi(){
		var str = document.form1.action;
		str += '?subject='+encodeURI('主题');
		str += '&keyword='+encodeURI('关键字');
		var groupId = document.getElementById('groupId').value;
		if(groupId != null && groupId != ''){
			str += '&groupid='+groupId;
		}else{
			Ext.MessageBox.alert('提示框','<nobr>请选择所属文件夹</nobr>');
			return;
		}
		var beizhu = document.getElementById('beizhu').value;
		if(beizhu != null && beizhu != ''){
			if(beizhu.length>=221){
				Ext.MessageBox.alert('提示框','<nobr>摘要最多为220字</nobr>');
				return;
			}
			str += '&beizhu='+encodeURI(beizhu);
		}
		/**检查客户端是否存在上传文件
		var fso = new ActiveXObject("Scripting.FileSystemObject"); 
		var b = true;
		for(var j = 1;j<=5;j++){
			var a = document.getElementById('file'+j).value;
			if(a != '' && a != null){
			var fileName = fso.FileExists(a);
			if(!fileName){
				alert('请检查第'+j+'个文件上传路径是否正确！');
				b = false;
			}
			}
		}
		if(b){
			document.form1.action = str;
			document.form1.submit();
			showProgress();
		} 
		**/
		var num = document.getElementById("files").getElementsByTagName("input").length;
		if(num == 0){
			Ext.MessageBox.alert('提示框','<nobr>请选择上传文件</nobr>');
		}else{
			document.form1.action = str;
			document.form1.submit();
		}
	}
	
	
	function xianshiDan(fu){
		document.getElementById("DanDiv").style.top = document.body.clientHeight/6;
		document.getElementById("DanDiv").style.left = document.body.clientWidth/8;
		document.getElementById("blackdiv").style.display = "block";
		document.getElementById("DanDiv").style.display = "block";
		GroupDan(fu)
	}
	
	function xiaoshiDan(){
		document.getElementById("blackdiv").style.display = "none";
		document.getElementById("DanDiv").style.display = "none";
		document.getElementById('groupNameDan').value = '';
		document.getElementById('xuserid').value = '';
		document.getElementById('xusername').value = '';
		
	}
	
	function newDanName(str){
		document.getElementById('groupNameDan').value = str.alt;
		document.getElementById('xusername').value = str.alt;
		document.getElementById('xuserid').value = str.value;
	}
	function overDan(){
		var xuserid = document.getElementById('xuserid').value;
		var xusername = document.getElementById('xusername').value;
		if(xusername!=''){
			document.getElementById('groupId').value = xuserid;
			document.getElementById('groupName').value = xusername;
		}else{
			document.getElementById('groupId').value = '';
			document.getElementById('groupName').value = '';
		}
		xiaoshiDan();
	}
	function GroupDan(fu){
		var Grouphtml = '<table width="96%" style="margin:3px;"><tr>';
			var b = 1;
			for(var a=0;a<fu.length;a=a+2){
				var id = fu[a];
				var name = fu[a+1];
				if(name.length>5)name = name.substring(0,5);
				Grouphtml += '<td width="30%" align="left"><input type="radio" name="123" alt="'+fu[a+1]+'" value="'+id+'" onclick="newDanName(this)"/>'+name+'</td>';
				if(b%3 == 0){
					Grouphtml += '</tr><tr>';
				}else if(a+1 == fu.length-1){
					Grouphtml += '</tr>';
				}
				b++;
			}
			var GroupNameDiv = document.getElementById("DanNameDiv");
			GroupNameDiv.innerHTML = Grouphtml+'</table>';
	}
	
	window.onload = function(){
		document.getElementById("right").style.width = document.body.clientWidth-5;
		var tb = new Ext.Toolbar(
			{
				height:25
			}
		);
	
	    tb.render('menu');
		tb.add(
	    {
	            text:'确定',
	            iconCls: 'daohang',
	        	handler: function(){
	        		fuzhi();
				}
	    },
	    {
	            text:'返回',
	            iconCls: 'daohang',
	        	handler: function(){
	        		location.href="<%=basePath%>tjsinfo/tjsoa/fileDocument/loginFileDocument.do";
				}
	    }
	    );
		tb.addFill();
	    tb.addText('<img id="windowResize" src="<%=basePath%>images/m_icon05.gif;"><a style="font-weight:bold; color:black;line-height: 22px;">文档发布</a>&nbsp;&nbsp;&nbsp;');
	}
	</script>
	
	<!-- 执行上传文件操作的函数 start-->
		<script type="text/javascript">
		var deleteFile;
		var alreadyUploadFile='';
		var uploadUrl='<%=basePath %>tjsinfo/tjsoa/system/ajaxFileUpload.do?method=uploader';
		var deteleFileUrl='<%=basePath %>tjsinfo/tjsoa/system/ajaxFileUpload.do?method=deleted';
		</script>
		<!-- 执行上传文件操作的函数 end-->	
		<script type="text/javascript">
	     function test(){
	    	 Ext.Ajax.request({
	    		 url:'<%=basePath%>tjsinfo/tjsoa/fileDocument/getFold.do',
	    		 success:function(response){
	    		      var obj = Ext.decode(response.responseText);
	    		      var aa = obj.test;
	    		      xianshiDan(aa);
	    		 }
	    	 })
	     }
	</script>
</head>

<body>
  <div id="right" style="height: 100%">
      <div id="menu" style="padding-top:4px;"></div>
      <div class="contact_content" style="height: 92%">
         	  <div class="wjsdcontent" style="border-top:0px;">
         	  <form action="<%=basePath %>/tjsinfo/tjsoa/fileDocument/uploadAll.do" name="form1" method="post" enctype="multipart/form-data" onsubmit="fuzhi();">
                  <table width="100%" border="0" cellspacing="0" >
                    <tr>
                      <td align="right" width="11%">摘要(不得大于220字)</td>
                      <td colspan="3"><textarea name="beizhu" id="beizhu" cols="95" rows="10"></textarea></td>
                    </tr>
                    <tr>
                      <td align="right" width="11%">所属文件夹</td>
                      <td colspan="3"><input id="groupName" name="groupName" type="text" size="50" readonly="readonly"/>
                      <a href="javaScript:test()"><img src="<%=basePath%>images/icon100.gif" /></a>
                      <input id="groupId" name="groupId" type="hidden"/>  
                      </td>
                    </tr>
                    <tr>
                      <td align="right">添加文件</td>
                      <td colspan="3">&nbsp;</td>
                    </tr>
                    <tr>
                      <td align="right" width="11%">文档列表</td>
                      <td colspan="3"><span><input type="file" UNSELECTABLE="on"  name="uploadFile" id="uploadFile" size="34" class="textinput" />&nbsp;<a style="cursor: hand" onclick="ajaxFileUpload()"><img src="<%=basePath %>images/scicon.gif" /></a></span>
               							<div class="sc_listLong"><ul id="uploadList"></ul></div>
                      </td>
                    </tr>
                    <tr>
                      <td colspan="4" height="20">&nbsp;</td>
                    </tr>
                    <input id="basePath" value="<%=basePath%>" type="hidden"/>
					<input  type="hidden" name="node" id="node" value=""/>
					<div id="files" style="display: none;"></div>
                  </table>
                  </form>
          	</div>
 			</div>          
  </div>
<div id="blackdiv" class="black_overlays">
	<iframe style="width:100%;height:100%;filter:alpha(opacity=0);-moz-opacity:0"></iframe>
</div>

<div id="DanDiv" class="GroupDiv">
    <table width="478" border="0" cellpadding="0" cellspacing="0" >
               <tr>
                 <td background="<%=basePath%>images/small_07.gif" height="24" align="left">
                 <table width="99%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="8%" style="padding-left:15px; padding-top:3px;"><img src="<%=basePath%>images/icon_07.gif" /></td>
                        <td width="92%" style="color:#FFFFFF; font-weight:bold;padding-top:3px">选择所属文件夹</td>
                      </tr>
                    </table>
                 </td>
               </tr>
               <tr>
                 <td align="center" class="zz">
                     <table width="100%" height="180" border="0" cellspacing="0" cellpadding="0" >
                      <tr><td colspan="3" align="center">
                      <div style="height: 10px"></div>
                       <div id="DanNameDiv" style="overflow-y:scroll; overflow-x:hidden;height: 150px;width: 90%;">
                       </div>
                      </td>
                      </tr>
                      <tr>
                        <td width="20%">&nbsp;</td>
                        <td width="13%">选文件夹:</td>
                        <td width="67%" align="left">
	                        <input name="groupNameDan" id="groupNameDan" type="text" size="30" class="textinput" readonly="readonly"/>
	                        <input type="hidden" id="xuserid"/>
	                        <input type="hidden" id="xusername"/>
                        </td>
                      </tr>
                      <tr>
                        <td colspan="3">&nbsp;</td>
                      </tr>
                      <tr><td colspan="3" style="border-top:1px #CFCFD1 solid">&nbsp;</td></tr>
                      <tr>
                        <td colspan="3" align="center"><a href="javaScript:overDan();" id="xuanquedan"><img src="<%=basePath%>images/qd.gif" /></a>&nbsp;&nbsp;
                        <a href="javaScript:xiaoshiDan();"><img src="<%=basePath%>images/qx.gif" />
                        </td>
                      </tr>
                      <tr>
                        <td colspan="3">&nbsp;</td>
                     </tr>
                    </table>
</td>
</tr>
</table>
</div>
</body>
</html>
